package com.app.lcl.entities;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Table;

@Entity
@Table(name="person_table")
public class PersonJPA {
	
	/*指定使用复合主键类是Name*/
	@EmbeddedId
	@AttributeOverrides({
		@AttributeOverride(name="first",column=@Column(name="person_first")),
		@AttributeOverride(name="last",column=@Column(name="person_last",length=20))
	})
	private NameJPA name;
	
	//普通属性
	@Column(name="person_email")
	private String email;
	@Embedded
	@AttributeOverrides({
		@AttributeOverride(name="name",column=@Column(name="cat_name",length=35)),
		@AttributeOverride(name="color",column=@Column(name="cat_color"))
	})
	//组件属性，代表此人拥有宠物
	private CatJPA pet;
	public NameJPA getName() {
		return name;
	}
	public void setName(NameJPA name) {
		this.name = name;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public CatJPA getPet() {
		return pet;
	}
	public void setPet(CatJPA pet) {
		this.pet = pet;
	}
	
	
}
